<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html ng-app="app" id="ng-app">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<%@include file="/include/style.jsp"%>
<%@include file="/include/script.jsp"%>
<script type="text/javascript" src="/js/page/enum.js?v=<%=Constants.VERSION %>"></script>
<script type="text/javascript" src="/js/page/license.js?v=<%=Constants.VERSION %>"></script>
<script type="text/javascript">
</script>
</head>
<body ng-controller="LicenseCtrl">
	<div class="toolbar">
		<div class="left-area">
			<form ng-submit="search()">
				<input type="text" ng-model="formCondition.keyword" placeholder="订单编号/MAC地址/授权码模糊匹配" class="search-box">
				<select ng-change="search()" ng-model="formCondition.status" ng-options="option for option in LICENSE_STATUS" >
					<option value="">状态</option>
				</select>
			</form>
		</div>
  		<div class="right-area">
  		</div>
	</div>
	
	<div ng-if="page.rows.length>0">
		<table class="data-table" style="table-layout:fixed;">
			<thead>
				<tr>
					<th width="14%" style="text-align: left;">订单编号</th>
					<th width="15%" style="text-align: left;">驱动</th>
					<th width="13%" style="text-align: left;">MAC地址</th>
					<th width="17%" style="text-align: left;">授权码</th>
					<th width="8%" ng-click="sortBy('activate_date')" class="sort">激活日期&nbsp;<i ng-class="direction('activate_date')">&nbsp;</i></th>
					<th width="8%" ng-click="sortBy('expire_date')" class="sort">授权过期日&nbsp;<i ng-class="direction('expire_date')">&nbsp;</i></th>
					<th width="10%" ng-click="sortBy('last_check_time')" class="sort">上次验证时间&nbsp;<i ng-class="direction('last_check_time')">&nbsp;</i></th>
					<th width="7%">状态</th>
					<permission:valid permission="<%=Constants.LICENSE_CUD%>">
					<th width="8%">操作</th>
					</permission:valid>
				</tr>
			</thead>
		   <tbody>
			  <tr ng-repeat="license in page.rows">
				  <td ng-bind="license.orderId"></td>
				  <td>
				  	<span ng-bind="license.driver.type"></span>：
				  	<span ng-bind="license.driver.name"></span><br>
				  	<small ng-bind="license.driver.provider.name"></small>
				  </td>
				  <td ng-bind="license.mac"></td>
				  <td ng-bind="license.license"></td>
				  <td align="center" ng-bind="license.activateDate | date: 'yyyy/MM/dd'"></td>
				  <td align="center" ng-bind="license.expireDate | date: 'yyyy/MM/dd'"></td>
				  <td align="center" style="font-size:80%;">
				  	<span ng-bind="license.lastCheckTime | date: 'yyyy/MM/dd'"></span><br/>
				  	<span ng-bind="license.lastCheckTime | date: 'HH:mm:ss'"></span>
				  </td>
				  <td align="center" ng-bind="license.status"></td>
				  <permission:valid permission="<%=Constants.LICENSE_CUD%>">
				  <td align="center">
					<span class="btn btn-link" ng-click="disableLicense(license)" ng-if="license.status!='Disabled'"><i class="fa fa-ban"></i> 解绑</span>
					<span class="btn btn-link" ng-click="enableLicense(license)" ng-if="license.status=='Disabled'"><i class="fa fa-repeat"></i> 恢复</span>
				  </td>
				  </permission:valid>
			  </tr>
		   </tbody>
		</table>
		
		<%@include file="/include/pageBar.jsp" %>
	</div>
	
	<div class="alert alert-success" style="clear: both;" ng-if="page.rows.length==0">
		暂无数据！
	</div>
</body>
</html>